import 'package:flutter/material.dart';

class SizeFit {
  static const double standardHeight = 812.0;
  static const double standardWidth = 375.0;
  static double screenWidth = 375.0;
  static double screenHeight = 812.0;

  ///初始化
  static void init(BuildContext context) {
    screenWidth = MediaQuery.of(context).size.width;
    screenHeight = MediaQuery.of(context).size.height;
  }

  ///屏幕百分比设置高度
  static double setHeight(double size) {
    return size * screenHeight / standardHeight;
  }

  ///屏幕百分比设置宽度
  static double setWidth(double size) {
    return size * screenWidth / standardWidth;
  }
}
